Example #1
0
File: tests.py Project: nt3rp/bacon
    def test_verify_duplicate_actor(self):
        instance = importer.load_file('tests/data/1.json')

        actual = instance.datastore.to_dict()
        expected = {
            'films': {'Film 1': set(['Actor 1'])},
            'actors': {'Actor 1': set(['Film 1'])}
        }
        self.assertDictEqual(expected, actual)
Example #2
0
File: tests.py Project: nt3rp/bacon
    def test_stash_and_load(self):
        instance = importer.load_file('tests/data/1.json')
        instance.load_file('tests/data/2.json')

        expected = instance.datastore.to_dict()

        instance.stash('test.p')
        instance.from_stash('test.p')

        actual = instance.datastore.to_dict()
        self.assertDictEqual(expected, actual)
Example #3
0
File: tests.py Project: nt3rp/bacon
    def test_verify_data_multiple(self):
        instance = importer.load_file('tests/data/1.json')
        instance.load_file('tests/data/2.json')

        actual = instance.datastore.to_dict()
        expected = {
            'films': {
                'Film 1': set(['Actor 1']),
                'Film 2': set(['Actor 1', 'Actor 2'])
            },
            'actors': {
                'Actor 1': set(['Film 1', 'Film 2']),
                'Actor 2': set(['Film 2'])
            }
        }
        self.assertDictEqual(expected, actual)
Example #4
0
File: tests.py Project: nt3rp/bacon
 def test_film_title_missing(self):
     try:
         importer.load_file('tests/data/missing_title.json')
     except:
         self.fail('Should not throw an exception for missing title.')
Example #5
0
File: tests.py Project: nt3rp/bacon
 def test_non_json(self):
     try:
         importer.load_file('tests/data/non_json.txt')
     except:
         self.fail('Should not throw an exception for non-json file.')