Exemplo n.º 1
0
    def test_fake_id(self):
        for i in range(100):
            self.assertTrue(validator.is_valid(validator.fake_id()))

        self.assertTrue(validator.is_valid(validator.fake_id(False)))
        self.assertTrue(validator.is_valid(validator.fake_id(True, '上海市', '2000', 1)))
        self.assertTrue(validator.is_valid(validator.fake_id(True, '江苏省', '20000101', 1)))
        self.assertTrue(validator.is_valid(validator.fake_id(True, '台湾省', '20131010', 0)))
Exemplo n.º 2
0
 def test_fake_id(self):
     self.assertEquals(validator.is_valid(validator.fake_id()), True)
     self.assertEquals(validator.is_valid(validator.fake_id(False)), True)
     self.assertEquals(
         validator.is_valid(validator.fake_id(True, '上海市', '2000', 1)),
         True)
     self.assertEquals(
         validator.is_valid(validator.fake_id(True, '江苏省', '20000101', 1)),
         True)
     self.assertEquals(
         validator.is_valid(validator.fake_id(True, '台湾省', '20131010', 0)),
         True)
Exemplo n.º 3
0
 def generateID(self):
     birthday = self.birthday_line_edit.text().replace('-', '')
     birthday = birthday if birthday else None
     address = self.address_line_edit.text()
     address = address if address else None
     sex = self.sex_combobox.currentText()
     sex = 1 if sex == '男' else 0
     try:
         id_ = validator.fake_id(True, address, birthday, sex)
     except:
         id_ = validator.fake_id()
     self.idcard_line_edit.setText(id_)
Exemplo n.º 4
0
    def login_auth(self, ac, pwd):

        # CreatIDnum() 可能阿B升级了验证,不推荐使用了,没有合法性校验
        need_auth = self.login(ac=ac, pwd=pwd)
        if need_auth == -1:  # 这里漏了一句,无法检测验证码。
            return -1
        if need_auth == 1:
            if use_my_id:
                real_id = AutomatorRecorder.load("./idcard.json")
                id_list = list(real_id.keys())
                count = random.randint(0, len(id_list) - 1)
                self.auth(auth_name=id_list[count], auth_id=real_id[id_list[count]])
            else:
                birthday = str(random.randint(1970, 1999))
                auth_name, auth_id = random_name(), validator.fake_id(birthday=birthday)
                self.auth(auth_name=auth_name, auth_id=auth_id)