File: MockPost.py

package info (click to toggle)
usgs 0.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,320 kB
  • sloc: python: 769; makefile: 153
file content (25 lines) | stat: -rw-r--r-- 405 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

import os
import json

testdir = os.path.dirname(os.path.abspath(__file__))


class MockPost(object):


    def __init__(self, filename):
        self.filename = filename


    def __call__(self, url, payload):
        return self


    def json(self):
        filepath = os.path.join(testdir, 'data', self.filename)

        with open(filepath) as f:
            data = json.load(f)

        return data