Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
twitter_syncer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
twitter_syncer
Commits
4581f23b
Commit
4581f23b
authored
Oct 21, 2024
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api to add account
parent
4e94b8be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
accounts-db.go
accounts-db.go
+9
-0
accounts_test.go
accounts_test.go
+27
-0
No files found.
accounts-db.go
View file @
4581f23b
...
...
@@ -80,3 +80,12 @@ func SetNotAvailable(username string, errStr string) error {
return
err
}
func
AddAccount
(
acc
Account
)
error
{
//fmt.Printf("add account %v\n", acc)
res
,
_
,
err
:=
client
.
From
(
"accounts"
)
.
Insert
(
acc
,
true
,
""
,
"representation"
,
""
)
.
Execute
()
_
=
res
return
err
}
accounts_test.go
View file @
4581f23b
...
...
@@ -163,6 +163,33 @@ func TestRateLimiter(t *testing.T) {
}
}
func
TestAddAccount
(
t
*
testing
.
T
)
{
acclist
:=
`ADeirdre20860----PtmcQvWd1DoD----tlugmeqmyt@rambler.ru----1589408cnVMmCa----P7G5GRG7ULCYKBMY----808f3b93ac4f9b0ac5085a3b1ba608e1c1a8e675
EulaSusann56500----SuIZROXhN14D----szahcqejrt@rambler.ru----9911065aAPM8ga----XDC6WMJEH4ILTTXN----f44e136089679d62247f353570be9cc78c60ff6b
MShondra82485----B7P38LYzz----mvwadpmfxr@rambler.ru----5973556MwG4gqa----I6XQJHQMUUL5MDXX----a43cbb2fd4a891e0513169131fe7dc7a0bb54f1f
KylieBritt10079----up1kj10rgjkry----xttuuxbtdc@rambler.ru----9507993gP7QJCa----GDZ6QWDQ5Q2KDOE5----330f127059d8a686cc0bc82e12aac5380fce9b03
StevieJ95145----9XqzE8JBSd----kkkfqtgkym@rambler.ru----5141799R36rxaa----ZFRHKNVV3TAU6GJ6----55bbfe00bfc34c4e9e7cc6d46eef0cd79ff31284`
accs
:=
strings
.
Split
(
acclist
,
"
\n
"
)
for
_
,
v
:=
range
accs
{
info
:=
strings
.
Split
(
v
,
"----"
)
if
len
(
info
)
!=
6
{
t
.
Errorf
(
"invalid account info %s"
,
v
)
}
else
{
record
:=
Account
{
Username
:
info
[
0
],
Password
:
info
[
1
],
Email
:
info
[
2
],
F2A
:
info
[
4
],
Available
:
true
,
}
if
err
:=
AddAccount
(
record
);
err
!=
nil
{
t
.
Error
(
err
)
}
else
{
t
.
Logf
(
"add account %s success"
,
record
.
Username
)
}
}
}
}
func
TestLogin
(
t
*
testing
.
T
)
{
//userCookies := make(map[string][]*http.Cookie)
info
:=
[]
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment