Exemplo n.º 1
0
    def test_get_context_variables(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variables(), {
            'PROJECT_NAME': 'foo'})
Exemplo n.º 2
0
    def test_get_context_variable(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variable('PROJECT_NAME'), 'foo')
        self.assertNotEqual(state.get_context_variable('not_created'), 'foo')
Exemplo n.º 3
0
    def test_update_context_variables(self):
        state = State()

        state.update_context_variables([1, 2, 3])

        self.mocked_facio_state_State_warning.assert_called_once_with(
            'Failed to update context variables with [1, 2, 3]')
Exemplo n.º 4
0
    def test_update_context_variables(self):
        state = State()

        state.update_context_variables([1, 2, 3])

        self.mocked_facio_state_State_warning.assert_called_once_with(
            'Failed to update context variables with [1, 2, 3]')
Exemplo n.º 5
0
    def test_get_context_variables(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variables(),
                         {'PROJECT_NAME': 'foo'})
Exemplo n.º 6
0
    def test_save_hook_call(self):
        state = State()

        state.save_hook_call('foo.bar', 'baz')
        state.save_hook_call('baz.foo', 'bar')
        calls = state.save_hook_call('foo.bar', 'baz')

        self.assertEqual(calls, [('foo.bar', 'baz'), ('baz.foo', 'bar')])
Exemplo n.º 7
0
    def test_save_hook_call(self):
        state = State()

        state.save_hook_call('foo.bar', 'baz')
        state.save_hook_call('baz.foo', 'bar')
        calls = state.save_hook_call('foo.bar', 'baz')

        self.assertEqual(calls, [('foo.bar', 'baz'), ('baz.foo', 'bar')])
Exemplo n.º 8
0
    def test_get_hook_call(self):
        state = State()

        state.save_hook_call('foo.bar', 'baz')
        state.save_hook_call('baz.foo', 'bar')

        self.assertEqual(state.get_hook_call('foo.bar'), 'baz')
        self.assertEqual(state.get_hook_call('baz.foo'), 'bar')
Exemplo n.º 9
0
    def test_get_hook_call(self):
        state = State()

        state.save_hook_call('foo.bar', 'baz')
        state.save_hook_call('baz.foo', 'bar')

        self.assertEqual(state.get_hook_call('foo.bar'), 'baz')
        self.assertEqual(state.get_hook_call('baz.foo'), 'bar')
Exemplo n.º 10
0
    def test_get_context_variable(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variable('PROJECT_NAME'), 'foo')
        self.assertNotEqual(state.get_context_variable('not_created'), 'foo')
Exemplo n.º 11
0
    def test_get_context_variables_empty(self):
        state = State()

        self.assertEqual(state.get_context_variables(), {})
Exemplo n.º 12
0
    def test_return_project_root(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_root(), '/bar/foo')
Exemplo n.º 13
0
    def test_get_context_variables_empty(self):
        state = State()

        self.assertEqual(state.get_context_variables(), {})
Exemplo n.º 14
0
    def test_return_project_root(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_root(), '/bar/foo')
Exemplo n.º 15
0
    def test_return_current_working_dir(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_working_directory(), '/foo')
Exemplo n.º 16
0
    def test_get_set_project_name(self):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_name(), 'foo')
Exemplo n.º 17
0
    def test_return_current_working_dir(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_working_directory(), '/foo')
Exemplo n.º 18
0
    def test_same_instance_always_returned(self):
        s1 = State()
        s2 = State()

        self.assertEqual(s1.state, s2.state)
Exemplo n.º 19
0
    def test_get_set_project_name(self):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_name(), 'foo')