Esempio n. 1
0
    def test_case_supplying_config(self):
        config = {'some': 'value'}
        test = run_test(TempResourceCase, config=config)
        self.assertTrue(test.data.success,
                        'Case failed when it should have succeeded')

        self.assertEqual(test.config, config, 'Test ran with the wrong config')
Esempio n. 2
0
    def test_block_supplying_resource_via_kwargs(self):
        resource = DemoResource(
            data=DemoResourceData.objects.get(name=RESOURCE_NAME))

        test = run_test(TempResourceBlock, test_resource=resource)
        self.assertTrue(test.data.success,
                        'Case failed when it should have succeeded')

        self.assertEqual(test.test_resource, resource,
                         "Test didn't get the supplied resource")
Esempio n. 3
0
    def test_block_supplying_config(self):
        config = {'some': 'value'}
        resource = DemoResource(
            data=DemoResourceData.objects.get(name=RESOURCE_NAME))

        test = run_test(TempResourceBlock, config=config,
                        test_resource=resource)
        self.assertTrue(test.data.success,
                        'Case failed when it should have succeeded')

        self.assertEqual(test.config, config, 'Test ran with the wrong config')
Esempio n. 4
0
 def test_case_not_supplying_any_resource(self):
     test = run_test(TempResourceCase)
     self.assertTrue(test.data.success,
                     'Case failed when it should have succeeded')
Esempio n. 5
0
 def test_block_not_supplying_any_resource(self):
     with self.assertRaises(AttributeError):
         run_test(TempResourceBlock)