def test_add(self): bl1 = BuildsList.from_dict_list(self.data) bl2 = BuildsList.from_dict_list(self.more_data) exp_data = self.data + self.more_data exp_bl = BuildsList.from_dict_list(exp_data) out_bl = bl1 + bl2 assert id(out_bl) != id(exp_bl) assert out_bl == exp_bl assert len(out_bl) == len(self.data) + len(self.more_data) assert isinstance(out_bl, BuildsList)
def test_as_repoman_conf(self, monkeypatch): monkeypatch.setenv('JENKINS_URL', 'http://jenkins.example.org') exp = dedent(""" http://jenkins.example.org/u3/5 http://jenkins.example.org/u4/3 """).lstrip() bl = BuildsList.from_dict_list(self.more_data) out = bl.as_repoman_conf() assert exp == out
def test_from_env_json(self, monkeypatch): exp = BuildsList.from_dict_list(self.data) monkeypatch.setenv('BUILDS_LIST', self.data_str) bl = BuildsList.from_env_json() assert id(exp) != id(bl) assert exp == bl monkeypatch.delenv('BUILDS_LIST', raising=False) bl = BuildsList.from_env_json() assert bl == []
def test_as_dict_list(self): bl = BuildsList.from_dict_list(self.data) out = bl.as_dict_list() assert self.data == out
def test_from_json_str(self): exp = BuildsList.from_dict_list(self.data) bl = BuildsList.from_json_str(self.data_str) assert id(exp) != id(bl) assert exp == bl
def test_from_dict_list(self): bl = BuildsList.from_dict_list(self.data) assert len(self.data) == len(bl) assert next((False for b in bl if not isinstance(b, BuildPtr)), True)