Ejemplo n.º 1
0
 def test_set_names(self, model: Model, mock_ttg: Mock):
     model._journals = ['', 'c', 'd']
     model._journal_mapping = {'c': 'e', 'd': 'f'}
     model._journal_index = 1
     model.set_names()
     assert model.names == ['', 'a', 'b']
     assert model._name_mapping == {'a': '1', 'b': '2'}
Ejemplo n.º 2
0
def model(mocker: MockFixture, mock_journals) -> Model:
    model = Model()
    mock_set_names = mocker.patch.object(model, 'set_names')

    def set_names(*args, **kwargs):
        model._names = ['', 'Vincent']
        model._name_mapping = {'Vincent': '1234'}

    mock_set_names.side_effect = set_names
    return model
Ejemplo n.º 3
0
 def test_set_journal_index(self, model: Model):
     model.set_journal_index(1)
     assert model._journal_index == 1
Ejemplo n.º 4
0
 def test_set_name_index(self, model: Model):
     model.set_name_index(1)
     assert model._name_index == 1
Ejemplo n.º 5
0
 def test_set_journals(self, model: Model, mock_journals: Mock):
     model.set_journals()
     assert model._journal_mapping == {'w': 'x', 'y': 'z'}
     assert model.journals == ['', 'w', 'y']
Ejemplo n.º 6
0
 def test_pin(self, model: Model):
     assert model.pin == ''
     model._pin = '1234'
     assert model.pin == '1234'
Ejemplo n.º 7
0
 def test_sheet_id(self, model: Model):
     model._journals = ['', 'c', 'd']
     model._journal_mapping = {'c': 'e', 'd': 'f'}
     assert model.sheet_id is None
     model._journal_index = 1
     assert model.sheet_id == 'e'
Ejemplo n.º 8
0
 def test_journal(self, model: Model):
     model._journals = ['', 'c', 'd']
     assert model.journal is None
     model._journal_index = 1
     assert model.journal == 'c'
Ejemplo n.º 9
0
 def test_journals(self, model: Model):
     assert model.journals == []
     model._journals = ['', 'c', 'd']
     assert model.journals == ['', 'c', 'd']
Ejemplo n.º 10
0
 def test_name(self, model: Model):
     assert model.name is None
     model._name_index = 1
     model._names = ['', 'a', 'b']
     assert model.name == 'a'
Ejemplo n.º 11
0
 def test_names(self, model: Model):
     assert model.names == []
     model._names = ['', 'a', 'b']
     assert model.names == ['', 'a', 'b']
Ejemplo n.º 12
0
def model():
    return Model()
Ejemplo n.º 13
0
 def test_login(self, model: Model):
     assert not model.login()
     model._names = ['', 'a']
     model._name_mapping = {'a': '1234'}
     model.set_name_index(1)
     model.set_pin('1234')
     assert model.login()
     model.set_pin('5678')
     assert not model.login()
Ejemplo n.º 14
0
 def test_set_pin(self, model: Model):
     model.set_pin('1234')
     assert model.pin == '1234'